<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>aws-crt-cpp: /home/ANT.AMAZON.COM/dengket/doc/aws-crt-cpp/include/aws/crt/crypto/HMAC.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">aws-crt-cpp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_076842b242c291358044feb169933571.html">aws</a></li><li class="navelem"><a class="el" href="dir_cc4322e4b2151c90adb7cd2e3f54423a.html">crt</a></li><li class="navelem"><a class="el" href="dir_39e380afaaa4ac8ea3c0de67127c8f7f.html">crypto</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">HMAC.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="HMAC_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;).</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * You may not use this file except in compliance with the License.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * A copy of the License is located at</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *  http://aws.amazon.com/apache2.0</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * or in the &quot;license&quot; file accompanying this file. This file is distributed</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * express or implied. See the License for the specific language governing</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * permissions and limitations under the License.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="Exports_8h.html">aws/crt/Exports.h</a>&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="Types_8h.html">aws/crt/Types.h</a>&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">struct </span>aws_hmac;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceAws.html">Aws</a></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="keyword">namespace </span>Crt</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    {</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;        <span class="keyword">namespace </span>Crypto</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        {</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;            <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> SHA256_HMAC_DIGEST_SIZE = 32;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="Exports_8h.html#a0a3f6c46aee6b588ce99a142cdb22d1d">AWS_CRT_CPP_API</a> <a class="code" href="namespaceAws_1_1Crt_1_1Crypto.html#ab8d08b685154ffebfe4322e852e7237b">ComputeSHA256HMAC</a>(</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                <a class="code" href="namespaceAws_1_1Crt.html#a3c9efb213e2de565038afcfd4f8afcda">Allocator</a> *allocator,</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;secret,</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;input,</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                <a class="code" href="namespaceAws_1_1Crt.html#aa760a7d9714d6c28091c2b1cf7029876">ByteBuf</a> &amp;output,</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                <span class="keywordtype">size_t</span> truncateTo = 0) noexcept;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="Exports_8h.html#a0a3f6c46aee6b588ce99a142cdb22d1d">AWS_CRT_CPP_API</a> <a class="code" href="namespaceAws_1_1Crt_1_1Crypto.html#ab8d08b685154ffebfe4322e852e7237b">ComputeSHA256HMAC</a>(</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                const <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;secret,</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;                const <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;input,</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                <a class="code" href="namespaceAws_1_1Crt.html#aa760a7d9714d6c28091c2b1cf7029876">ByteBuf</a> &amp;output,</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;                <span class="keywordtype">size_t</span> truncateTo = 0) noexcept;</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">   57</a></span>&#160;            class <a class="code" href="Exports_8h.html#a0a3f6c46aee6b588ce99a142cdb22d1d">AWS_CRT_CPP_API</a> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> final</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;            {</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;              <span class="keyword">public</span>:</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;                ~<a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a>();</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a3a39f3c2e4b4c99e1db442211107695c">   61</a></span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a3a39f3c2e4b4c99e1db442211107695c">HMAC</a>(<span class="keyword">const</span> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#ac813bdf144653872c4f15316aafa9d7f">   62</a></span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;<a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#ac813bdf144653872c4f15316aafa9d7f">operator=</a>(<span class="keyword">const</span> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a>(<a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;&amp;toMove);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;operator=(<a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> &amp;&amp;toMove);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a9c59441ec9174627d1885b8a560e2082">   69</a></span>&#160;                <span class="keyword">inline</span> <span class="keyword">operator</span> bool() const noexcept { <span class="keywordflow">return</span> m_good; }</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a170e7fc71c13e00fe5f2bfceb1b5565c">   74</a></span>&#160;                <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a170e7fc71c13e00fe5f2bfceb1b5565c">LastError</a>() const noexcept { <span class="keywordflow">return</span> m_lastError; }</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                <span class="keyword">static</span> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> CreateSHA256HMAC(<a class="code" href="namespaceAws_1_1Crt.html#a3c9efb213e2de565038afcfd4f8afcda">Allocator</a> *allocator, <span class="keyword">const</span> <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;secret) noexcept;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                <span class="keyword">static</span> <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a> CreateSHA256HMAC(<span class="keyword">const</span> <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;secret) noexcept;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                <span class="keywordtype">bool</span> Update(<span class="keyword">const</span> <a class="code" href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">ByteCursor</a> &amp;toHMAC) noexcept;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;                <span class="keywordtype">bool</span> Digest(<a class="code" href="namespaceAws_1_1Crt.html#aa760a7d9714d6c28091c2b1cf7029876">ByteBuf</a> &amp;output, <span class="keywordtype">size_t</span> truncateTo = 0) noexcept;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;              private:</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a>(aws_hmac *hmac) noexcept;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                <a class="code" href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">HMAC</a>() = delete;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160; </div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                aws_hmac *m_hmac;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                <span class="keywordtype">bool</span> m_good;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                <span class="keywordtype">int</span> m_lastError;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            };</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        } <span class="comment">// namespace Crypto</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    }     <span class="comment">// namespace Crt</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;} <span class="comment">// namespace Aws</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespaceAws_1_1Crt_html_a3c9efb213e2de565038afcfd4f8afcda"><div class="ttname"><a href="namespaceAws_1_1Crt.html#a3c9efb213e2de565038afcfd4f8afcda">Aws::Crt::Allocator</a></div><div class="ttdeci">aws_allocator Allocator</div><div class="ttdef"><b>Definition:</b> StlAllocator.h:25</div></div>
<div class="ttc" id="aclassAws_1_1Crt_1_1Crypto_1_1HMAC_html_a3a39f3c2e4b4c99e1db442211107695c"><div class="ttname"><a href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a3a39f3c2e4b4c99e1db442211107695c">Aws::Crt::Crypto::HMAC::HMAC</a></div><div class="ttdeci">HMAC(const HMAC &amp;)=delete</div></div>
<div class="ttc" id="aTypes_8h_html"><div class="ttname"><a href="Types_8h.html">Types.h</a></div></div>
<div class="ttc" id="aExports_8h_html_a0a3f6c46aee6b588ce99a142cdb22d1d"><div class="ttname"><a href="Exports_8h.html#a0a3f6c46aee6b588ce99a142cdb22d1d">AWS_CRT_CPP_API</a></div><div class="ttdeci">#define AWS_CRT_CPP_API</div><div class="ttdef"><b>Definition:</b> Exports.h:34</div></div>
<div class="ttc" id="aclassAws_1_1Crt_1_1Crypto_1_1HMAC_html_a170e7fc71c13e00fe5f2bfceb1b5565c"><div class="ttname"><a href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#a170e7fc71c13e00fe5f2bfceb1b5565c">Aws::Crt::Crypto::HMAC::LastError</a></div><div class="ttdeci">int LastError() const noexcept</div><div class="ttdef"><b>Definition:</b> HMAC.h:74</div></div>
<div class="ttc" id="anamespaceAws_1_1Crt_html_a14ac076b0baa520bccb2b7236e4e78b7"><div class="ttname"><a href="namespaceAws_1_1Crt.html#a14ac076b0baa520bccb2b7236e4e78b7">Aws::Crt::ByteCursor</a></div><div class="ttdeci">aws_byte_cursor ByteCursor</div><div class="ttdef"><b>Definition:</b> Types.h:44</div></div>
<div class="ttc" id="anamespaceAws_1_1Crt_1_1Crypto_html_ab8d08b685154ffebfe4322e852e7237b"><div class="ttname"><a href="namespaceAws_1_1Crt_1_1Crypto.html#ab8d08b685154ffebfe4322e852e7237b">Aws::Crt::Crypto::ComputeSHA256HMAC</a></div><div class="ttdeci">bool AWS_CRT_CPP_API ComputeSHA256HMAC(Allocator *allocator, const ByteCursor &amp;secret, const ByteCursor &amp;input, ByteBuf &amp;output, size_t truncateTo=0) noexcept</div><div class="ttdef"><b>Definition:</b> HMAC.cpp:25</div></div>
<div class="ttc" id="anamespaceAws_1_1Crt_html_aa760a7d9714d6c28091c2b1cf7029876"><div class="ttname"><a href="namespaceAws_1_1Crt.html#aa760a7d9714d6c28091c2b1cf7029876">Aws::Crt::ByteBuf</a></div><div class="ttdeci">aws_byte_buf ByteBuf</div><div class="ttdef"><b>Definition:</b> Types.h:43</div></div>
<div class="ttc" id="aclassAws_1_1Crt_1_1Crypto_1_1HMAC_html_ac813bdf144653872c4f15316aafa9d7f"><div class="ttname"><a href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html#ac813bdf144653872c4f15316aafa9d7f">Aws::Crt::Crypto::HMAC::operator=</a></div><div class="ttdeci">HMAC &amp; operator=(const HMAC &amp;)=delete</div></div>
<div class="ttc" id="anamespaceAws_html"><div class="ttname"><a href="namespaceAws.html">Aws</a></div><div class="ttdef"><b>Definition:</b> Api.h:25</div></div>
<div class="ttc" id="aExports_8h_html"><div class="ttname"><a href="Exports_8h.html">Exports.h</a></div></div>
<div class="ttc" id="aclassAws_1_1Crt_1_1Crypto_1_1HMAC_html"><div class="ttname"><a href="classAws_1_1Crt_1_1Crypto_1_1HMAC.html">Aws::Crt::Crypto::HMAC</a></div><div class="ttdef"><b>Definition:</b> HMAC.h:58</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
